package jp.co.iris_ltd.irisphotoeditor.util;

import android.graphics.Canvas;
import android.graphics.Paint;
import android.view.MotionEvent;

public abstract class ArtTool implements Cloneable {

    public static enum ToolMode {
        Pen,
        Stamp,
        Text,
        Frame,
        Effect,
    }

    protected ToolMode mMode;
    protected Paint mPaint = new Paint();
    protected float mX = 0f;
    protected float mY = 0f;
    protected float mOffsetX = 0f;
    protected float mOffsetY = 0f;
    protected float mScale;
    protected int mOriantation;
    protected boolean mIsFinalized = false;

    public ArtTool() {
    }

    @Override
    public Object clone() throws CloneNotSupportedException {
        return super.clone();
    }

    public ToolMode getMode() {
        return mMode;
    }

    public void finalize() {
        mIsFinalized = true;
    }

    public boolean isFinalized() {
        return mIsFinalized;
    }

    public void setOffset(float offsetX, float offsetY) {
        mOffsetX = offsetX;
        mOffsetY = offsetY;
    }

    public void setOrientation(int orientation){
        mOriantation = orientation;
    }

    public void setScale(float x, float y, float scale) {
        mOffsetX = x;
        mOffsetY = y;
        mScale = scale;
    }

    public void setPaint(Paint paint) {
        mPaint = paint;
    }

    public Paint getPaint() {
        return mPaint;
    }

    public abstract void setPosition(MotionEvent event, float scale);

    public abstract void drawCanvas(Canvas canvas);

    public abstract void restoreCanvas(Canvas canvas);

    public abstract void onDrawingFinish();
}
